// components/chooseItemCheck/chooseItemCheck.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    itemSource: {
      type: Array,
      value: [],

    },
    attr: {
      type: String,
      value: 'text'
    },
    selectIndex: {
      type: Number,
      value: 0
    },
    hasLine: {
      type: Boolean,
      value: false
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    selectIndex: 0
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onSelect: function (e) {
      let index = e.currentTarget.dataset.index;
      let list = e.currentTarget.dataset.list;
      const itemData = {
        list: list,
        index: index
      }
      this.setData({
        selectIndex: index
      });

      this.triggerEvent('itemselect', itemData)
    }
  }
})
